package com.ruoyi.framework.Sms;

import com.ruoyi.common.constant.Constants;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * @Author laohei
 * @Date 2020/11/13 9:50
 * @Version 1.0
 */
@Service
public class SmsCodeService implements ISmsCodeService{

    //验证码校验
    @Override
    public boolean checkSmsCode(String phoneNumber, String smsCode, String smsCodeType) {
        return false;
    }

    //发送验证码短信
    @Override
    public boolean sendSMSCode(String phoneNumber,String smsCode, String smsCodeType) {
        if(StringUtils.isEmpty(phoneNumber)){
            throw new RuntimeException("请填写手机号码");
        }
        //校验手机号码格式
        if(!phoneNumber.matches(Constants.REGEX_CHECK_PHONE_NUMBER)) {
            throw new RuntimeException("手机号码格式错误");
        }
        return false;
    }

    @Override
    public boolean sendSMSNotice(String phoneNumber, String smsCodeType, String... paramList) {
        return false;
    }
}
